package com.thiswhyme.redis.subscribe;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate;

/**
 * @description: 默认消息发送器
 * @author: thiswhyme
 * @date: 2020/12/9
 */
@Slf4j
@AllArgsConstructor
public class DefaultRedisPublisher implements RedisPublisher {

    private final StringRedisTemplate redisTemplate;

    @Override
    public void publish(String channel, String message) {
        log.debug("【{}通道】开始发送消息，内容：{}", channel, message);
        redisTemplate.convertAndSend(channel, message);
    }
}
